﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Script.Services;
using QLHD.Models;
using System.Data.SqlClient;
using System.Globalization;

namespace QLHD.WS
{
    /// <summary>
    /// Summary description for ContractDetail
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    [ScriptService]
    public class ContractDetail : System.Web.Services.WebService
    {

        [WebMethod]
        public string HelloWorld()
        {
            return "Hello World";
        }


        [WebMethod(EnableSession = true)]
        [ScriptMethod]
        public List<dynamic> ListXNKL(object mahd)
        {
            QLHD2013Entities db = new QLHD2013Entities();
            int mahopdong=int.Parse(mahd.ToString());
            var lstxnkl = db.XNKLs.Where(q => q.MaHD == mahopdong).ToList();

            return (from item in lstxnkl
                   select new
                       {
                           MaXNKL = item.MaXNKL,
                           GiaTri=item.GiaTri,
                           SoHoaDon=item.SoHoaDon,
                           NgayXNKL=item.NgayXNKL

                       }).ToList<dynamic>();
        }
    }
}
